//----------------------------------------------------------------------------------------------------------------------
/// \file
/// <summary>Consumer class for Real time Etw events</summary>
// Copyright (c) Microsoft Corporation.  All Rights Reserved.
//----------------------------------------------------------------------------------------------------------------------
#pragma once
#include "EtwProcessor.h"
#include "EtwConsumer.h"

// Suppress warning 4481: nonstandard extension used: override specifier 'override'
#pragma warning(push)
#pragma warning(disable: 4481)

namespace Etw { namespace Processor
{
    /// <summary>
    /// Consumer class for Real time Etw events
    /// </summary>
    class ETWPROCESSOR_API EtwRealtimeConsumer : public EtwConsumer 
    {
    public:

        /// <summary>Construct a real time etw consumer</summary>
        /// <param name="pszTraceName">Name of the trace session to consume the events from</param>
        EtwRealtimeConsumer(const wchar_t* pszTraceName);
        ~EtwRealtimeConsumer();

        #ifdef ETWPROCESSOR_FULL_BUILD
        EtwRealtimeConsumer(const __wchar_t* pszTraceName);
        #endif

        /// <summary>Method to add/register an event provider in this trace session</summary>
        /// <param name="providerGuid">Guid of the event provider</param>
        /// <returns>S_OK if successfully enabled the provider</returns>
        HRESULT EnableProvider(const GUID &providerGuid);

        /// <summary>Method to remove/un-register an event provider in this trace session</summary>
        /// <param name="providerGuid">Guid of the event provider</param>
        /// <returns>S_OK if successfully disabled the provider</returns>
        HRESULT DisableProvider(const GUID &provierGuid);

        //Open a trace for the registered provider
        virtual HRESULT OpenTrace() override;

    private:
        EtwRealtimeConsumer(const EtwRealtimeConsumer&);//not implemented
        EtwRealtimeConsumer& operator=(const EtwRealtimeConsumer&);//not implemented

        HRESULT m_status;  // variable to track if any exceptions thrown

        struct EtwRealImpl;
        EtwRealImpl* m_pImpl;
    };
}/* namespace Processor */ } /* namespace Etw */

#pragma warning(pop)
